<%-- 
    Document   : SearchCircles
    Created on : Dec 7, 2011, 1:27:23 PM
    Author     : hendrikde
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList" %>
<% if(session.getAttribute("LoggedIn")==null)
       {
    response.sendRedirect("index.html");
    return;
        }

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Search Circles</title>
        <script type="text/javascript">
            
function row_circleclick(txt)
{
    document.forms[txt].submit();
}

function row_mousehover(obj)
{
	obj.style.backgroundColor="#6699FF";
}

function row_mouseout(obj)
{
	obj.style.backgroundColor="";
}
            </script>
    </head>
    <body>
        <h1>Search Circles</h1>
        <form name="SearchCircles" action="DoSearch.jsp" method="Post">
            Keyword: <input type="text" name="keyword"/><input type="submit" value="Search"/>
        </form><input type="button" value="Return" onclick="window.location='gohome.jsp'"/>
        <%
        ArrayList<DBClasses.SearchNode> sn = (ArrayList<DBClasses.SearchNode>) session.getAttribute("CircleSet");
        if (sn !=null) {%>
        <table width="800" border="0">
            <tr><th>Search Results</th></tr>
            <tr><td width="52" />
                  <td>Circle Name</td>
                  <td>Circle Type</td>
                  <td>Circle Owner</td></tr>
        <%
        for (int i = 0; i < sn.size(); i++) {
            String[] circdat = sn.get(i).getWordsSplit();
    %>
    <tr bgcolor="#CCCCCC" onclick ="row_click('<%="circle" +i%>')" onmouseover="row_mouseover(this)" onmouseout="row_mouseout(this)" >
            <form name="<%="circle" + i %>" action="CirclePage.jsp" method="post" >
            <input name="CIRC" type="hidden" value="<%=sn.get(i).getID()%>" />
            <td width="52"><img src="CircleLogo.png" alt="" width="52" height="52" /></td>
            <td><%=circdat[0]%></td>
            <td><%=circdat[1]%></td>
            <td><%=circdat[2]%></td></form></tr>
        <%;
        }
        %></table>
        <%
        session.setAttribute("CircleSet", null);       
        }
        %>
    </body>
</html>
